import request from '@/utils/request'

interface BannerParams {
  pageCurrent: number
  pageSize: number
}

interface BannerData {
  id?: number
  imageUrl: string
  linkUrl?: string
  sort?: number
  status?: number
  startTime?: string
  endTime?: string
}

// 获取banner列表
export function getBannerList(params: BannerParams) {
  return request({
    url: '/app/banner/list',
    method: 'get',
    params
  })
}

// 新增banner
export function addBanner(data: BannerData) {
  return request({
    url: '/app/banner',
    method: 'post',
    data
  })
}

// 修改banner
export function updateBanner(data: BannerData) {
  return request({
    url: '/app/banner',
    method: 'put',
    data
  })
}

// 删除banner
export function deleteBanner(id: number) {
  return request({
    url: `/app/banner/${id}`,
    method: 'delete'
  })
} 